// components/information-radio/information-radio.ts
Component({

  /**
   * 组件的属性列表
   */
  lifetimes: {
    attached: function () {
      this.setData({
        radioValue: this.properties.value
      })
    }
  },
  properties: {
    value: {
      type: Number,
      value: -1,
    },
    group: {
      type: Array,
      value: []
    },
    label: {
      type: String,
      value: "",
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    radioValue: -1,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleRadio(e: any) {
      const { id } = e.currentTarget.dataset;
      this.setData({
        radioValue: id,
      })
    },
    handleCancle() {
      this.triggerEvent("radioCancle")
    },
    handleConfirm() {
      this.triggerEvent("radioConfirm", {
        data: this.data.radioValue
      })
    }
  }
})